package com.ruoyi.framework.security.provider;

import com.ruoyi.framework.web.service.StudentDetailsServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.security.authentication.dao.DaoAuthenticationProvider;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.stereotype.Service;

import javax.annotation.PostConstruct;

@Service("studentAuthenticationProvider")
public class StudentAuthenticationProvider extends DaoAuthenticationProvider {
    @Autowired
    @Qualifier("studentDetailsService")
    private StudentDetailsServiceImpl studentDetailsService;

    @PostConstruct
    public void init() {
        setUserDetailsService(studentDetailsService);
        setPasswordEncoder(new BCryptPasswordEncoder());
    }

    /*@Override
    public boolean supports(Class<?> authentication) {
        return authentication.equals(StudentAuthenticationToken.class);
    }*/

}
